<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <script>
    const array = [2,5,3,54,12,32,53,1]
    let max = array.reduce((pre,cur)=>pre > cur ? pre : cur)
    console.log(max);

    // 字符串中出现次数最多的字母
    function func(str) {
      let obj = {}
      for(var i of str) {
        if(obj[i]) obj[i]++
        else{
          obj[i] = 1
        }
      }
      let count = 0
      let char
      for(var key in obj){
        if(obj[key] > count){
          count = obj[key]
          char = key
        }
      }
      console.log(count,char);
    }
    func('abssssfdasaaadsgr')
  </script>
</body>
</html>